<template>
   <div>
          <!--   综合数据  -->
     <div>
       <div class="header">
        综合数据

       </div>
       <div class="EchartBox">
         <div id="back2" ></div><!--装可视的表格-->
       </div>

     </div>

   </div>
</template>

<script>
import { mapState } from 'vuex'
import axios from "axios";
export default {
  name: "CompositeData",
  data(){
    return{
      CompositeData:[
        {value:2,name:'lisi'},
        {value:4,name:'liu '},
        {value:6,name:'fe'},
        {value:4,name:'s'},

      ],
    }
  },
  computed:{
    ...mapState(['setCompositeData'])
  },
  methods:{
     getComposite(){

     // let {data:res} = await axios.get('http://132.232.110.185/personnelManagement/dataStatistics/comprehensiveDataStatistics')
       axios({
         url: 'http://132.232.110.185/personnelManagement/dataStatistics/comprehensiveDataStatistics',
         method: 'get',

       }).then((response) => {


         this.$store.dispatch('setCompositeData',response.data.data)



       })

     },

    getCompositeData(){
      const myChart = this.$echarts.init(document.getElementById("back2"))//引入到盒子
      const option = {
        title: {
          text: '人才数据库统计',
          left: 'center'
        },
        tooltip: {
          trigger: 'item'
        },
        legend: {
          orient: 'vertical',
          left: 'left'
        },
        series: [
          {
            name: '综合数据',
            type: 'pie',
            radius: '50%',
            data: this.setCompositeData,
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      };
      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(option);

    },

  },
  mounted() {
    this. getCompositeData()
    this.getComposite()
  }
}
</script>

<style scoped>
.header{
  width: 100%;
  height: 74px;
  border-bottom: 1px solid rgba(0,0,0,0.3);
  padding-left:12px ;
  line-height: 74px;
  font-size: 18px;
}
.EchartBox{
  border: 1px solid;
  height: 700px;
  width: 100%;
}

#back2{
  width: 100%;
  text-align: center;
  height: 700px;
  line-height: 700px;
  margin:22px auto 0;

}
</style>